package com.colin.app.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by Colin on 2017/2/10.
 */

public class DemoBean implements Parcelable{
    private String title ;
    private String target ;
    private String description ;

    public DemoBean() {
    }

    public DemoBean(String title, String target, String description) {
        this.title = title;
        this.target = target;
        this.description = description;
    }

    public DemoBean(String stringArray) {
        String [] demoBeanArray = stringArray.split(",");
        this.title = demoBeanArray[0];
        this.target =  "com.colin.app.activity." + demoBeanArray[1];
        this.description = demoBeanArray[2];
    }

    protected DemoBean(Parcel in) {
        title = in.readString();
        target = in.readString();
        description = in.readString();
    }

    public static final Creator<DemoBean> CREATOR = new Creator<DemoBean>() {
        @Override
        public DemoBean createFromParcel(Parcel in) {
            return new DemoBean(in);
        }

        @Override
        public DemoBean[] newArray(int size) {
            return new DemoBean[size];
        }
    };

    public String getTitle() {
        return title;
    }

    public DemoBean setTitle(String title) {
        this.title = title;
        return this;
    }

    public String getTarget() {
        return target;
    }

    public DemoBean setTarget(String target) {
        this.target = target;
        return this;
    }

    public String getDescription() {
        return description;
    }

    public DemoBean setDescription(String description) {
        this.description = description;
        return this;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(title);
        dest.writeString(target);
        dest.writeString(description);
    }
}
